<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			function setColor(){
				let r=Math.floor(Math.random()*256)
				let g=Math.floor(Math.random()*256)
				let b=Math.floor(Math.random()*256)
				let color=`rgb(${r},${g},${b})`
				let span=document.querySelector("span").innerHTML=color
				document.body.setAttribute("style",`background-color:${color};`)
			}
		</script>
	</head>
	<body>
		<button onclick="setColor()"  type="button">随机背景</button>
		<span>rgb(255,255,255)</span> <!-- 共用一行 -->
	</body>
</html>
